package sys.module.lottery.dao.impl;

import java.util.List;

import org.springframework.jdbc.core.simple.ParameterizedBeanPropertyRowMapper;
import org.springframework.stereotype.Repository;

import sys.common.dao.impl.BaseDaoImpl;
import sys.module.lottery.dao.IPomeDAO;
import sys.module.lottery.model.PomeModel;

/**
 * <p>文件名称：PomeDaoImpl.java</p>
 * <p>文件描述：</p>
 * <p>版权所有： 版权所有(C)2000-2010</p>
 * <p>公    司： CWCA</p>
 * <p>内容摘要：TODO </p>
 * <p>其他说明： </p>
 * <p>完成日期：2014年2月15日</p>
 *
 * @author gao x 
 * @version 1.0 $Id: ican_code_comment.xml,v 1.3 2013/07/03 01:47:35 gaoxiang Exp $
 */
@Repository("PomeDao")
public class PomeDaoImpl extends BaseDaoImpl implements IPomeDAO {

	final static String SQL_QUERY_ALL = "SELECT * FROM model_pome";
	final static String SQL_UPDATA_ID = "UPDATE `model_pome` SET  `text` = ?,`about` = ? WHERE `id` = ?";

	@Override
	public List<PomeModel> queryAll() throws Exception {
		// TODO Auto-generated method stub
		return this.getConnection()
				.query(SQL_QUERY_ALL,
						ParameterizedBeanPropertyRowMapper
								.newInstance(PomeModel.class));
	}

	@Override
	public void updateModel(PomeModel model) throws Exception {
		// TODO Auto-generated method stub
		this.getConnection().update(SQL_UPDATA_ID, model.getText(),
				model.getAbout(), model.getId());
	}
}
